Arbitration of state changes

ABSTRACT

When multiple nodes in a computer network perform work on a shared entity, such as a database record, an arbitration process is used to ensure changes made by more than one node to the same data is propagated to each of the nodes holding the shared entity and that the changes are applied in the same order on each of the nodes. An arbitration cycle for a particular entity is begun on a node (“instigator”) when the node broadcasts a proposal message for a change to the entity to the other nodes or when the node (“observer”) receives such a proposal message. Multiple nodes can be instigators during a single arbitration cycle. Each node that receives a proposal message sends a response message to the corresponding instigator. The arbitration cycle is closed to additional proposal messages after one instigator has received responses from all the nodes that share the entity. After each instigator node receives all the proposals in the arbitration cycle, it determines whether it is the winner of the arbitration cycle and broadcasts a closure message if it is. Each node determines an order in which to apply the changes proposed in the arbitration cycle when it knows it has received all the proposals in the arbitration cycle as determined by the sending or receiving of the closure message. Because each arbitration cycle is associated with a particular entity, multiple arbitration cycles associated with different items can be running concurrently in the network but multiple arbitration cycles for the same item must be executed serially. The arbitration process is executed even if there is only one proposal made in an arbitration cycle since the arbitration process enables the orderly propagation of changes across all the nodes that share the entity.

FIELD OF THE INVENTION

[0001] This invention relates generally to distributed computer systems, and more particularly to arbitrating changes in state for entities shared among such distributed computer systems.

COPYRIGHT NOTICE/PERMISSION

[0002] A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever. The following notice applies to the software and data as described below and in the drawings hereto: Copyright© 1998, Microsoft® Corporation, All Rights Reserved.

BACKGROUND OF THE INVENTION

[0003] In a network in which multiple computers each process changes against the state of a shared entity, there must be a mechanism through which the computers cooperate when making the changes in such a way that all the computers come to the same decision about how the state should be changed. Locking and other synchronization primitives provide a way for multiple threads to coordinate changes to the same entity on the same computer. Across networked computers, however, some other synchronization mechanism is needed so that simultaneous changes to the same entity can be reconciled consistently by all the computers that share that object.

[0004] One previous solution to the problem designates a single computer in the network as a lock manager. The lock manager acts as a lock server to which the client computers in the network send their changes. The lock manager serializes the changes to ensure an orderly state change for shared entities. This solution is not entirely satisfactory. Not only is the lock manager a bottleneck in the processing of transactions through the network, but the computer acting as the lock manager must incorporate complex failsafe technology to prevent total shutdown of the network due to the failure of the lock server.

[0005] Other solutions focus on distributed locking protocols. A distributed locking protocol requires the implementation of a messaging protocol to handle the locking of the shared entity and to coordinate the changes among the computers so that the changes are applied in the proper order. While a distributed locking protocol does not rely on a designated computer to provide locking, only one computer in the network at a time manages the messaging protocol and so is subject to the same limitations as the lock manager solution.

[0006] Therefore, there is a need in the art for a mechanism that allows the distribution of the state change decision process among the interested computers, and which does not depend upon locking to ensure the proper ordering of the changes.

SUMMARY OF THE INVENTION

[0007] The above-mentioned shortcomings, disadvantages and problems are addressed by the present invention, which will be understood by reading and studying the following specification.

[0008] When multiple nodes in a computer network perform work on a shared entity, such as a database record, an arbitration process is used to ensure changes made by more than one node to the same data is propagated to each of the nodes holding the shared entity and that the changes are applied in the same order on each of the nodes. An arbitration cycle for a particular entity is begun on a node (“instigator”) when the node broadcasts a proposal message for a change to the entity to the other nodes or when the node (“observer”) receives such a proposal message. Multiple nodes can be instigators during a single arbitration cycle. Each node that receives a proposal message sends a response message to the corresponding instigator. The arbitration cycle is closed to additional proposal messages after one instigator has received responses from all the nodes that share the entity. After each instigator node receives all the proposals in the arbitration cycle, it determines whether it is the winner of the arbitration cycle and broadcasts a closure message if it is. Each node determines an order in which to apply the changes proposed in the arbitration cycle when it knows it has received all the proposals in the arbitration cycle as determined by the sending or receiving of the closure message. Because each arbitration cycle is associated with a particular entity, multiple arbitration cycles associated with different items can be running concurrently in the network but multiple arbitration cycles for the same item must be executed serially. The arbitration process is executed even if there is only one proposal made in an arbitration cycle since the arbitration process enables the orderly propagation of changes across all the nodes.

[0009] A particular implementation of the arbitration logic in conjunction with an in memory database that provides coherent caching among networked database client computers is disclosed.

[0010] The arbitration process of the present invention sends the changes as part of the messages required for synchronization and also provides for a much richer solution to the problem of asynchronous changes, e.g., rejecting certain changes, ordering changes, etc. depending on the type of entity being changed. Furthermore, a centralized lock service is not required as each computer in the network individually makes the determination of how to change the entity within its own cache.

[0011] The present invention describes systems, clients, servers, methods, and computer-readable media of varying scope. In addition to the aspects and advantages of the present invention described in this summary, further aspects and advantages of the invention will become apparent by reference to the drawings and by reading the detailed description that follows.

BRIEF DESCRIPTION OF THE DRAWINGS

[0012]FIG. 1 is a diagram of the hardware and operating environment in conjunction with which embodiments of the invention may be practiced;

[0013]FIGS. 2A and 2B are diagrams illustrating a system-level overview of an exemplary embodiment of the invention;

[0014]FIG. 3 is a state diagram for an exemplary embodiment of the invention executing on a computer;

[0015]FIGS. 4, 5, 6, 7, 8, 9, 10, 11 and 12 are flowcharts of methods to be performed by the states shown in FIG. 3;

[0016]FIG. 13 is a diagram of a proposal message data structure for use in an exemplary implementation of the invention;

[0017]FIG. 14 is a diagram of a proposal response message data structure for use in an exemplary implementation of the invention;

[0018]FIG. 15 is a diagram of a closure message data structure for use in an exemplary implementation of the invention;

[0019]FIG. 16 is a diagram of an arbitration object data structure for use in an exemplary implementation of the invention; and

[0020]FIG. 17 is a diagram of an arbitration manager data structure for use in an exemplary implementation of the invention.

DETAILED DESCRIPTION OF THE INVENTION

[0021] In the following detailed description of exemplary embodiments of the invention, reference is made to the accompanying drawings which form a part hereof, and in which is shown by way of illustration specific exemplary embodiments in which the invention may be practiced. These embodiments are described in sufficient detail to enable those skilled in the art to practice the invention, and it is to be understood that other embodiments may be utilized and that logical, mechanical, electrical and other changes may be made without departing from the spirit or scope of the present invention. The following detailed description is, therefore, not to be taken in a limiting sense, and the scope of the present invention is defined only by the appended claims.

[0022] The detailed description is divided into five sections. In the first section, the hardware and the operating environment in conjunction with which embodiments of the invention may be practiced are described. In the second section, a system level overview of the invention is presented. In the third section, methods for an exemplary embodiment of the invention are provided. In the fourth section, a particular in-memory database system implementation of the invention is described. Finally, in the fifth section, a conclusion of the detailed description is provided.

Hardware and Operating Environment

[0023]FIG. 1 is a diagram of the hardware and operating environment in conjunction with which embodiments of the invention may be practiced. The description of FIG. 1 is intended to provide a brief, general description of suitable computer hardware and a suitable computing environment in conjunction with which the invention may be implemented. Although not required, the invention is described in the general context of computer-executable instructions, such as program modules, being executed by a computer, such as a personal computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform particular tasks or implement particular abstract data types.

[0024] Moreover, those skilled in the art will appreciate that the invention may be practiced with other computer system configurations, including hand-held devices, multiprocessor systems, microprocessor-based or programmable consumer electronics, network PCs, minicomputers, mainframe computers, and the like. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote memory storage devices.

[0025] The exemplary hardware and operating environment of FIG. 1 for implementing the invention includes a general purpose computing device in the form of a computer 20, including a processing unit 21, a system memory 22, and a system bus 23 that operatively couples various system components, including the system memory 22, to the processing unit 21. There may be only one or there may be more than one processing unit 21, such that the processor of computer 20 comprises a single central-processing unit (CPU), or a plurality of processing units, commonly referred to as a parallel processing environment. The computer 20 may be a conventional computer, a distributed computer, or any other type of computer; the invention is not so limited.

[0026] The system bus 23 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. The system memory may also be referred to as simply the memory, and includes read only memory (ROM) 24 and random access memory (RAM) 25. A basic input/output system (BIOS) 26, containing the basic routines that help to transfer information between elements within the computer 20, such as during start-up, is stored in ROM 24. The computer 20 further includes a hard disk drive 27 for reading from and writing to a hard disk, not shown, a magnetic disk drive 28 for reading from or writing to a removable magnetic disk 29, and an optical disk drive 30 for reading from or writing to a removable optical disk 31 such as a CD ROM or other optical media.

[0027] The hard disk drive 27, magnetic disk drive 28, and optical disk drive 30 are connected to the system bus 23 by a hard disk drive interface 32, a magnetic disk drive interface 33, and an optical disk drive interface 34, respectively. The drives and their associated computer-readable media provide nonvolatile storage of computer-readable instructions, data structures, program modules and other data for the computer 20. It should be appreciated by those skilled in the art that any type of computer-readable media which can store data that is accessible by a computer, such as magnetic cassettes, flash memory cards, digital video disks, Bernoulli cartridges, random access memories (RAMs), read only memories (ROMs), and the like, may be used in the exemplary operating environment.

[0028] A number of program modules may be stored on the hard disk, magnetic disk 29, optical disk 31, ROM 24, or RAM 25, including an operating system 35, one or more application programs 36, other program modules 37, and program data 38. A user may enter commands and information into the personal computer 20 through input devices such as a keyboard 40 and pointing device 42. Other input devices (not shown) may include a microphone, joystick, game pad, satellite dish, scanner, or the like. These and other input devices are often connected to the processing unit 21 through a serial port interface 46 that is coupled to the system bus, but may be connected by other interfaces, such as a parallel port, game port, or a universal serial bus (USB). A monitor 47 or other type of display device is also connected to the system bus 23 via an interface, such as a video adapter 48. In addition to the monitor, computers typically include other peripheral output devices (not shown), such as speakers and printers.

[0029] The computer 20 may operate in a networked environment using logical connections to one or more remote computers, such as remote computer 49. These logical connections are achieved by a communication device coupled to or a part of the computer 20; the invention is not limited to a particular type of communications device. The remote computer 49 may be another computer, a server, a router, a network PC, a client, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 20, although only a memory storage device 50 has been illustrated in FIG. 1. The logical connections depicted in FIG. 1 include a local-area network (LAN) 51 and a wide-area network (WAN) 52. Such networking environments are commonplace in offices, enterprise-wide computer networks, intranets and the Internet.

[0030] When used in a LAN-networking environment, the computer 20 is connected to the local network 51 through a network interface or adapter 53, which is one type of communications device. When used in a WAN-networking environment, the computer 20 typically includes a modem 54, a type of communications device, or any other type of communications device for establishing communications over the wide area network 52, such as the Internet. The modem 54, which may be internal or external, is connected to the system bus 23 via the serial port interface 46. In a networked environment, program modules depicted relative to the personal computer 20, or portions thereof, may be stored in the remote memory storage device. It is appreciated that the network connections shown are exemplary and other means of and communications devices for establishing a communications link between the computers may be used.

[0031] The hardware and operating environment in conjunction with which embodiments of the invention may be practiced has been described. The computer in conjunction with which embodiments of the invention may be practiced may be a conventional computer, a distributed computer, or any other type of computer; the invention is not so limited. Such a computer typically includes one or more processing units as its processor, and a computer-readable medium such as a memory. The computer may also include a communications device such as a network adapter or a modem, so that it is able to communicatively couple to other computers.

System Level Overview

[0032] A system level overview of the operation of an exemplary embodiment of an arbitration process in accordance with the present invention is described by reference to FIGS. 2A and 2B. FIGS. 2A and 2B illustrate exemplary arbitration processes as performed by three computers, such as computer 20 or 49 in FIG. 1, that are peer nodes in a local area network, such as network 51. Nodes in the network that share at least one data entity are referred to a belonging to a “domain.” The data entity can be an object, a record, a counter, or the like that is required to be distributed among nodes in the network. For example, a domain can consist of all the nodes in the network that are working on a particular table in a distributed database.

[0033] Because any number of the nodes in a domain can make simultaneous changes to the particular shared entity such that the state of the entity is changed, an arbitration process in accordance with the present invention is utilized to ensure the state change is orderly and to propagate the state changes to each node in the domain. An arbitration cycle within the arbitration process is comprised of a number of operations that perform orderly state changes on the entity such that at the end of the cycle all nodes agree on the new value for the entity. A cycle begins with one or more nodes making proposals to change the entity. It is complete when all proposals are either rejected or sequentially ordered, and for ordered proposals, values assigned. For a given entity, multiple cycles must be serialized within the arbitration process, thus only one arbitration cycle per entity is active or “current” at a time. With respect to different entities, multiple cycles can run concurrently.

[0034] All nodes that initiate a proposal on the entity during a particular cycle are designated as “instigators” in the cycle; all other nodes in the domain are “observers” in the cycle. Information during the arbitration cycle is exchanged among the instigators and observers through arbitration messages. To minimize arbitration message traffic among the nodes, the instigators and observers in the exemplary embodiment are able to independently and coherently decide on rejection and ordering of proposals through an common evaluation operation resident on each node as described below. The proper outcome from the common evaluation operation is dependent on messages being delivered from one node to another in the order in which they were sent.

[0035] The exemplary arbitration cycles illustrated in FIGS. 2A and 2B contain four types of operations and three types of messages. A proposal operation (P) is triggered by a request, such as from an application program, to a node in the domain to modify some data entity held by the node. The proposal operation begins a new arbitration cycle for the entity on the node and creates an arbitration data structure to manage the cycle on the node. Data records, tables, lists or objects are equally applicable for use as the arbitration data structure. For purposes of clarity, the arbitration data structure is referred to as an arbitration object hereinafter, but the invention is not so limited by such use.

[0036] The node multicasts a proposal notification, or proposal, message (PN) to the other nodes in the domain. The proposal operation also lists the proposal with the arbitration object. The arbitration object maintains an list of all active proposals in the arbitration cycle, ordered on a proposal attribute such as time. Additional orderings are described below. If a proposal operation is triggered during an active arbitration cycle, the operation is blocked until the current cycle completes. The proposal operation designates the node as an “instigator” in the corresponding arbitration cycle.

[0037] A proposal can be to explicitly assign a value (such as an identifier for a database table) or a request to perform an operation (such as inserting, deleting or modifying a database record) that determines the new value of the entity upon completion of the arbitration. In the latter case the value is implicitly assigned when the proposal is ordered in the arbitration object.

[0038] An arbitrate operation (A) is triggered by the receipt of a proposal from another node. If there is no arbitration cycle for the particular entity on the receiving node, the arbitrate operation starts one and creates an arbitration object on the receiving node for the entity. The proposal is added to the list in the arbitration object on the node. The arbitrate operation concludes by sending a response notification, or response, message (RN) to the sender of the proposal.

[0039] If an arbitration cycle on a node is started by an arbitration operation instead of a proposal operation, the node is an observer in the cycle. On observer nodes, the arbitrate operation performs further processing as described below in conjunction with the terminate operation.

[0040] An evaluate operation (E) is triggered on an instigator node when a response has been received for each proposal sent in the current arbitration cycle. The evaluate operation examines the arbitration object to determine the proposal in the current cycle against some predetermined criteria to determine the proposal having the highest ranking. If the highest ranking proposal was initiated locally by this node, the local node is the winner of the arbitration and multicasts a closure notification, or closure, message (CN) to the other nodes in the domain and implicitly to itself. The closure message contains the list of nodes from which proposals were received, i.e., all the instigator nodes in the corresponding arbitration cycle. Optionally, the closure message contains the outcome of the evaluation operation, which specifies in which order to apply the proposals. When a common outcome decision process executes on each node, each node reaches the same result for a given arbitration cycle, so the optional information in the closure message is not necessary in this embodiment.

[0041] A terminate operation (T) is triggered by the receipt or sending of a closure message and must be initiated before the arbitration process can complete. The termination operation determines the ordering of the proposals for a loser instigator node or an observer node when a common outcome decision process is used. Upon completion of an arbitration cycle, the relevant information in the arbitration object is saved along with any optional outcome information sent in the closure message. The arbitration object is freed and another arbitration cycle on the corresponding entry can begin. Each node applies the changes to the entity in the order determined by the evaluation operation.

[0042] The termination operation itself is not always sufficient to terminate the arbitration cycle because the closure message is not guaranteed to be the last message that arrives in the cycle when more than two nodes are members of the domain.

[0043] Because of this, the evaluation and termination operations can occur in either order on an instigator node, so the termination operation saves the contents of the closure message for potential use in a later evaluation operation. The arbitration cycle completes when both the evaluation and termination operations have completed.

[0044] On an observer node, proposals sent by instigators that have lost the arbitration can arrive after the closure message from the winning instigator node. Only the winner's proposal message is guaranteed to arrive at the other nodes before the corresponding closure message. Furthermore, an observer node does not know how many instigators were in the arbitration cycle until the arrival of the closure message containing the list of instigators in the current cycle.

[0045] The termination operation determines if there is a proposal in the observer node's arbitration object for each instigator identified in the arbitration cycle. If there is, the cycle is complete. If the observer node is missing proposals from at least one instigator, the observer stores the corresponding node identifier(s) in the arbitration object. All subsequent proposals from other nodes trigger arbitrate operations but are otherwise queued until completion of the current arbitration cycle. During subsequent arbitrate operations, the observer node removes the associated node identifier from the arbitration object as the missing proposals arrive. Only when there are no more node identifiers in the arbitration object is the corresponding arbitration cycle complete.

[0046]FIG. 2A illustrates an example of the arbitration process resulting from two proposed changes to the same entity in a domain of three nodes. The operations and messages in the arbitration cycles for the arbitration process are shown in time-ordered sequence. Node1 201 initiates a proposal operation (P1) 202, which sends proposal message (PN) 203 to node2 211 and node3 221. At the same time, node2 211 initiates a proposal operation (P2) 212, which sends proposal message 213 to node1 201 and node 221. Corresponding arbitration cycles are begun on node1 201 and node 211 as part of the proposal operations.

[0047] Node2 211 receives the proposal message 203 from node1 202. Because node2 211 has not yet received responses to its proposal message 213, the proposal message 203 becomes part of the current arbitration cycle on node2 211. The receipt of the proposal message 203 triggers an arbitration operation (A1) 214 on node2 211, and as a result, node2 211 sends a response message (RN) 215 to node1 211.

[0048] Node3 221 receives the proposal message 213 from node2 211 before it receives the proposal message 203 from node1 201. The receipt of the proposal message 213 begins an arbitration cycle on node3 221 and triggers an arbitration operation (A2) 222. Node3 221 sends a response message 223 to node3 211.

[0049] Node1 201 receives the proposal message 213 from node2 211 and includes it in the current arbitration cycle because node1 201 has not yet received responses to its proposal message 203. The proposal message 213 triggers an arbitration operation (A2) 204 on node1 201, which causes node1 201 to send a response message 205 to node2 211.

[0050] Next in the sequence of events, node3 221 receives the proposal message 203 from node1 201, begins an arbitration operation (A1) 224, and sends a response message 225 to node1 201.

[0051] After node1 201 has received both response message 215 from node2 211 and response message 225 from node3 221, it begins an evaluation operation (E1) 206. The evaluation operation 206 determines node1 201 is the winner of the arbitration and sorts the proposals 203, 213 in an pre-determined order based on the outcome of the evaluation. The evaluation operation creates and sends a closure message 207 to nodes2 211 and node3 221. The sending of the closure message triggers a terminate operation 208 on node1 201. At the completion of the termination operation 208, the arbitration cycle on node1 201 is complete.

[0052] The arbitration cycles on node2 211 and node3 221 are still active at the time the arbitration cycle 201 completes because neither has yet received the closure message 207.

[0053] Receipt of both the response messages 205, 223 on node2 211 triggers an evaluation operation (E2) 216. The evaluation operation 216, which uses the same factors as the evaluation operation 206 on node1 201, determines that node2 211 is the loser of the arbitration. The arbitration cycle on node2 211 remains active until the closure message 207 arrives from node1 201 and causes the termination operation 217 to execute. The arbitration cycle on node2 211 is now complete.

[0054] Because node3 221 is an observer node in the arbitration process, it cannot define a current arbitration cycle until it learns which proposals belong to which arbitration cycle through the receipt of the closure message 207 from node1 201. The closure message 207 triggers a termination operation 226 that determines all proposals in the current arbitration cycle have been received, orders them as a result of executing the common outcome decision process, and terminates the cycle.

[0055]FIG. 2B illustrates the same operations and messages, except that the time sequence is different. In FIG. 2B, node3 221 receives the proposal message 213 from node2 211 after the proposal message 203 and the closure message 207 from node1 201. Because the proposal message 213 is missing when the terminate operation 226 executes, the termination operation 226 cannot order the proposals and so the arbitration cycle on node3 221 is not terminated by the terminate operation 226. The arrival of the proposal message 213 triggers the arbitrate operation 222, which permits the termination operation 226 to properly order the proposals and terminate the arbitration cycle.

[0056] Similarly, the arbitration cycle for node2 211 does not terminate when the termination operation 217 is triggered by the arrival of the closure message 207. In this case, the evaluation operation 216 has not yet been performed because node2 211 has not received the response message 225 from node3 211. Once the response message 225 arrives, the evaluation operation 216 executes, and the arbitration cycle for node2 211 is complete.

[0057] Note that in both FIGS. 2A and 2B, no message from one node to another node arrives, or is processed, before a prior message from the same node. This restriction, referred to as the Notification Rule, is enforced by the strict, ordered delivery of messages within the network. If a node has more than one message from the same node in its message queue, the receiving node relies on ordering information supplied by the network to determine the order in which to process the messages.

[0058] The Notification Rule, working in conjunction with the rule that a proposal is included in an arbitration cycle for a node if it is received after that node has broadcast its proposal but before it received a response, ensures that the set of proposals for the current arbitration cycle are the same on all instigator nodes. Assuming that proposal 212 from node2 211 is included in the current arbitration cycle on node1 201, i.e., the arbitration cycle that started with instigating proposal 202 on node1 201. Then proposal 202 must be in the current arbitration cycle on node2 211 that includes proposal 212 because if proposal 212 is included in the current arbitration cycle on node1 201, then the response 215 to proposal 202 from node2 211 was received after proposal 212. Similarly since proposal 202 was sent from node1 201 before proposal 212 was received by node1 201 then the response 205 from node1 201 will be sent after proposal 202. Therefore node2 211 will receive the proposal 202, and response 205 in that order and as a result proposal 202 will be included in the arbitration cycle on node2 211. It is easy to see by induction that the current arbitration cycle on all instigator nodes includes the exact same set of proposals.

[0059] The system level overview of the operation of an exemplary embodiment of the arbitration process of the present invention has been described in this section of the detailed description. The arbitration process executes an arbitration cycle on each node in a network that shares an entity when a change is proposed to the entity by a node. In one embodiment, the arbitration cycle on each node determines the proper order in which to apply the changes upon termination of the arbitration cycle. In an alternate embodiment, the order is determined at the winning node and propagated to the other nodes. While the invention is not limited to any particular network configuration, for sake of clarity a simplified three node network has been described.

Methods of Exemplary Embodiments of the Invention

[0060] In the previous section, a system level overview of the operations of exemplary embodiments of the invention was described. In this section, the particular methods performed by a computer executing such exemplary embodiments are described by reference to a state diagram and a series of flowcharts. The methods to be performed constitute computer programs made up of computer-executable instructions. Describing the methods by reference to a state diagram or flowchart enables one skilled in the art to develop such programs including such instructions to carry out the methods on suitable computer (the processor of the computers executing the instructions from computer-readable media).

[0061]FIG. 3 is a state diagram of the states of an exemplary embodiment of arbitration process 300 operating on a node, and illustrates the messages that cause changes in state of an arbitration object executing the process. FIGS. 4-12 are flowcharts of the methods executed by the arbitration cycle while in the states shown in FIG. 3. As described in the previous section, there is a single arbitration cycle for a particular entity active at any given time, but multiple arbitration cycles can be executing on a node when more than one entity is being changed. Thus, one of skill in the art will immediately perceive that FIGS. 3-12 illustrate multithreaded computer programs. This section described the methods for the arbitration process as being implemented in an arbitration object, with one instance of the arbitration object per entity. Although, the terms “arbitration object” and “instance of an arbitration object” are used interchangeably, the meaning will be readily understood by one of skill in the art. Furthermore, one of skill in the art will readily recognize the proper interpretation of the term “state” through its application to either the arbitration object or to the data entity.

[0062] Referring first to FIG. 3, the arbitration object associated with a particular entity begins at an idle state 303 on a node (the “local” node). The creation of the arbitration object is described in conjunction with FIGS. 4 and 5 immediately below. The arbitration object transitions to a waiting for closure state 304 when the local node receives a proposal concerning the entity from another node in the domain (a “remote” node). The arbitration object processes all subsequent messages involving the entity as an observer 302 until the current arbitration cycle is terminated. The arbitration object transitions from the idle state 303 to a waiting for responses state 306 when the local node proposes a change to the entity. Under these circumstances, the arbitration object processes all subsequent messages involving the entity as an instigator 301 until the current arbitration cycle terminates.

[0063]FIG. 4 illustrates the method performed when the local node initiates a proposal to change an entity, i.e., is an instigator. First, it determines if an arbitration object for the entity to be changed already exists (block 401). If not, one is created with a state of idle (block 403). The handling of the proposal depend on the state of the arbitration object (block 405). If the state is not idle, then the arbitration object adds the proposal to an unprocessed proposal queue (also known as the pre-arbitration queue) (block 407) to be processed after the completion of the current arbitration cycle. Queuing the proposal puts the transaction thread that proposed the change to sleep (block 408). The thread is awakened when it is the first locally created proposal on the unprocessed proposal queue and all proposals on the queue are local proposals as part of the post-cycle processing as described below in conjunction with FIG. 11. The proposal is removed from the queue and the processing starting with block 405 is repeated.

[0064] If the state of the arbitration object is idle, the arbitration object adds the proposal to a list of current proposals and broadcasts it to all the remote nodes in the domain, i.e., the other nodes that are also working on the entity (block 409), which begins the arbitration cycle for an instigator node. The arbitration object then transitions to the waiting for responses state 306 at block 411. The transaction thread is put to sleep at block 413. It is awakened when it is its turn to change the object as described in the proposal (block 415). After the change is applied, the thread invokes a post arbitration process (block 1200) so that any arbitrated proposals remaining in an arbitrated proposals queue (also known as the post-arbitration queue) can be applied.

[0065] When a proposal message is received from a remote node (so that the local node acts as an observer), the check for an existing arbitration object is performed (block 501 in FIG. 5), and one is created at idle if it does not exist (503). At block 504, the local nodes sends a proposal response to the remote node that broadcast the proposal. If the state of the arbitration object is idle, the proposal message is added to the unprocessed proposal queue (block 506) and the arbitration object transitions to the waiting for closure state 304 as an observer (block 507) to begin an new arbitration cycle. If the state of the arbitration object is not idle, the remote proposal message is handled by the arbitration object as described below in conjunction with FIGS. 6-8.

[0066] The two types of arbitration cycles are next discussed individually with reference to the flowcharts in FIGS. 6-12, beginning with the arbitration process for an observer node.

[0067] The arbitration object remains in the waiting for closure state 304 until it receives a closure message. As discussed in the previous section, as an observer, the local node can receive additional proposals while it is waiting for the closure message and cannot determine which proposals belong to the current arbitration cycle until it receives the closure message. Once the node receives the closure message, the nodes involved in the current arbitration cycle are defined but the arbitration cycle cannot terminate until the arbitration object receives a proposal from each node in the cycle. Therefore, once the closure message is received, the arbitration object can transition from the waiting for closure state 304 to a waiting for proposals state 305 if all the proposals have not yet been received, or back to the idle state 303 if all the proposals have been received, which terminates the current arbitration cycle.

[0068] The processing for the waiting for closure state 304 is shown in FIG. 6 and described next for an observer node. When the arbitration object receives a message, it determines if the message is a closure message or a proposal message. An arbitration object for an observer node will not receive response messages since the node has not initiated a proposal.

[0069] If the message is a proposal message (block 601), the arbitration object adds the message in the unprocessed proposal queue associated with the arbitration object (block 603) because, as discussed in the previous section, an observer cannot tell which proposals belong to the current arbitration cycle until it receives a closure message. Proposal messages initiated locally are also queued in the unprocessed proposal queue.

[0070] Messages in the unprocessed proposal queue are maintained in the order in which they are received at the node. The unprocessed proposal queue associates each message with the node that sent it.

[0071] If the message is a closure message (block 601), the arbitration object determines if the closure message is for the current cycle (block 605). In one exemplary embodiment, the determination is made by counting the number of unprocessed proposals received from the same node that sent the closure message. Because a proposal message is guaranteed to arrive before the closure message from the same node, at least one proposal message will have been received. If there is only one such proposal message in the unprocessed proposals queue, the closure message is for the current arbitration cycle. If there is more than one such proposal message, then the closure message is for a different arbitration cycle and gets added to the unprocessed proposal queue (block 603). Consider for example, the sequence of messages P1, P2, C sent from node N1 to node N2, where P1 and P2 are proposals and C is a closure message. The current arbitration cycle is initiated by P1. The fact that C follows P2 implies node N1 sent C after sending P2 and therefore the closure message C belongs to the same cycle as P2. C cannot belong to the current arbitration cycle since that would imply that two proposals from the same node belong to the same cycle, which is not allowed in the present invention. In order for C to belong to the current cycle, the sequence must be P1, C, P2.

[0072] When the closure message is determined to be for the current arbitration cycle, it is logged (block 607). The log process copies the list of instigator nodes in the closure message into a list of nodes in the current arbitration cycle, which defines the proposal messages that the arbitration object must receive before it can terminate the current arbitration cycle. The arbitration process scans the unprocessed proposal queue and updates the list of current proposals by adding the first proposal on the queue from each node belonging to the current arbitration cycle. The arbitration object also maintains a list of nodes from which it has received proposals (list of received proposals), so it adds the appropriate nodes to that list as well.

[0073] At this point, the arbitration object can determine if it has received all the proposals for the current arbitration cycle on the observer node (block 609). If it has, it invokes a termination process (block 1000), which is described below in conjunction with FIG. 10, that sets the arbitration object back to the idle state 303. If not, the arbitration object transitions to the waiting for proposals state 305 (block 611). The processing for the waiting for proposals state 305 is illustrated in FIG. 7. Note that the waiting for proposals state 305 is unique to an arbitration object on an observer node.

[0074] Once in the waiting for proposals state 305, the arbitration object can receive closure messages as well as proposal messages Because an arbitration object is in the waiting for proposals state 305 as a result of receiving a closure message for the current arbitration cycle, any closure message received during the waiting for proposals state 305 is added to the unprocessed proposal queue (block 703).

[0075] A proposal message that is received is checked against the list of nodes in the current cycle from which the arbitration object is expecting proposals (block 705). If it is not from such a node, the proposal is added to the unprocessed proposal queue (block 707). If it is from such a node, the arbitration object determines if a proposal has already been received for the node (block 709). Any additional proposals received from a node are added to the unprocessed proposal queue (block 707). If the proposal message is from a node that was missing a proposal message, the proposal is added to the list of current proposals (block 709) and to the list of nodes for which proposal message have been received (block 711).

[0076] If all the expected proposals have been received (block 713), then the arbitration object invokes the termination process (block 1000) and transitions back to the idle state 303. Otherwise, the arbitration remains in the waiting for proposals state 305.

[0077] Proceeding now to the arbitration process 301 for an instigator in FIG. 3, the arbitration object remains in the waiting for responses state 306 until the local node has received responses from each of the remote nodes to which the proposal message was sent. While in the waiting for responses state 306, the arbitration object can receive closure messages and additional proposals, as well as responses. The processing for the waiting for response state 306 is illustrated in FIG. 8.

[0078] If the local node receives a closure message 801, the arbitration object determines if a closure message (block 803) for the current cycle has previously been logged (referring to block 809). If so, then the closure message is added to the unprocessed proposal queue. If there is no current closure message, the arbitration object determines if the received closure message is for the current cycle (block 807). The closure message belongs to the current arbitration cycle if 1) there is a proposal from the same remote node in the current arbitration proposal list, and 2) there are no proposals from that remote node in the unprocessed proposal queue. As in block 707, a closure message from a node having only one proposal is a closure message for the current cycle. Other closure messages are added to the unprocessed proposal queue (block 805).

[0079] The closure message for the current cycle is logged (block 809). The arbitration object determines whether it has received responses from all the nodes in the current cycle (block 823). If not, the arbitration object remains in the waiting for responses state 306. When all responses for the current cycle are received, the arbitration object invokes the termination process (block 1000). Note that in this case, the node sending the closure has already been determined the winner of the arbitration.

[0080] If the message is a proposal message (block 811), the arbitration object determines whether it has already received a response from the node that sent the proposal (block 813). If so, the proposal is added to the unprocessed proposal queue. Otherwise, the proposal is added to the list of current proposals for the arbitration cycle (block 817) and to the list of received proposals (block 819).

[0081] When a response message is received, the arbitration object adds it to a list of received responses (block 821). The list is then checked against the list of expected responses for the current cycle (block 823). If all the expected responses have been received and a closure message has not yet been received (block 825), the arbitration object invokes the evaluation process (block 900).

[0082]FIG. 9 illustrates the evaluation process 900. The process begins by deciding the winner of the arbitration based on the proposals in the cycle (block 901) using a predetermined ranking criteria. If the local node is the winner, the proposals are ordered and added to the arbitrated proposals queue (block 907) based on a pre-determined ordering criteria.

[0083] Both the pre-determined ranking and ordering criteria are dependent upon the type of the entity being changed and the changes proposed. Thus, the arbitration object for a specific type of entity contains the appropriate criteria to determine the proper rank and order of the proposals. In one exemplary embodiment, the pre-determined ranking criteria is the unique transaction identifier, and the node that instigated the proposal with the highest rank is the winner of the arbitration. In this exemplary embodiment, the pre-determined ordering criteria is the same as the pre-determined ranking criteria so the winner's proposal is ordered first. In an alternate embodiment, the ordering criteria is decoupled from the ranking criteria so the ordering criteria can be a complicated as comparing the changes in each proposal to determine the best order in which to apply the proposals, or that a proposal cannot be applied because it is mutually exclusive to another proposal in the cycle. The unique node identifier can also be used as the ranking criteria or ordering criteria.

[0084] In a further alternate embodiment, certain proposals are considered “expedited.” An expedited proposal is one that must be processed in conjunction with a previous, already arbitrated proposal. For example, a single transaction A can make two different modifications (A1 and A2) to the same database record. After applying the proposal A1 to the record, the database manager locks the record so no additional changes could be made until the transaction A commits or aborts the change. If a proposal B1 for the same record from a different transaction B was put in the change queue for the record before the proposal A2 (i.e., the proposal B1 won the arbitration over the proposal A2), the proposal A2 could not be processed until the proposal B1 was applied. But the proposal B1 cannot be applied until the transaction A releases the lock and the transaction A cannot release the lock until the proposal A2 is applied. This results in a classic “deadlock” situation as will be readily understood by one skilled in the art. Classifying proposal A2 as an expedited proposal causes it to be added to the arbitrated proposals queue before all non-expedited proposals such as B1 but after any existing expedited proposals. This avoids the deadlock situation. Additionally, one expedited proposal can execute simultaneously with a non-expedited proposal as described below in conjunction with FIG. 12.

[0085] The closure message is created and sent to the other nodes in the arbitration cycle (block 909). In an alternate embodiment in which only the winner node executes the ordering logic, the resulting order is included in the closure message to ensure the other nodes apply the proposals in the proper order. The arbitration object state is set to idle (block 911) and a common post cycle process is performed (block 1100) as described in conjunction with FIG. 11 below.

[0086] If the local node is not the winner (block 903), the arbitration object's state is set to waiting for closure (block 905). In an alternate embodiment not illustrated, when the local node is capable of executing the ordering logic itself, the local node transitions directly to the termination process shown in FIG. 10. Thus, it does not follow the state change arrow from the waiting for responses state 306 to the waiting for closure state 307 in FIG. 3, but instead follows the state change arrow from the waiting for responses state 306 to the idle state 303 just as does the winning node.

[0087] Returning to FIG. 6, an arbitration object in the waiting for closure state 307 on an instigator node receives only proposal and closure messages since all the response messages for the current cycle have been received. If the message is a proposal message (block 601), it is added to the unprocessed proposal queue because proposals that belong in the current arbitration cycle are defined as those received before all responses to the locally initiated proposal was received, and thus proposals received at this stage belong to a different arbitration cycle.

[0088] If the message is a closure message, the arbitration object determines if the closure message is for the current cycle at block 605. Because the local node is an instigator in the current arbitration cycle, the criteria differs somewhat from that described above for an observer node. The set of nodes in the current arbitration cycle is determined by the set of proposals in the list of current proposals (described with reference to FIG. 8). If the closure message is from a node that has no proposal in the list, the node is not part of the current cycle, and therefore, the closure message does not belong to the current cycle. If the closure message is from a node that is part of the current cycle, then the closure belongs to the current cycle as long as there are no proposals in the unprocessed proposals queue from that node, i.e., the sequence of messages from that node must be P1, C, P2 and not P1, P2, C, as previously explained for an observer node.

[0089] If it is not for the current cycle, the closure message is added to the unprocessed proposal queue (block 603). If it is for the current cycle, the closure message is logged at block 607 as described above. All proposals already have been received for this arbitration cycle at this stage (block 609), so the arbitration object invokes the termination process (block 1000).

[0090] The termination process 1000 is described in conjunction with FIG. 10. The proposals are queued in order on the arbitrated proposals queue (block 1001). The ordering determination is performed by the termination process using the same predetermined ranking and ordering criteria discussed above in conjunction with the evaluation process. In the alternate embodiment in which the termination process does not apply the ordering criteria, the proposals are ordered based on the information in the closure message. The arbitration object's state is set to idle (block 1003) and the common post cycle process is invoked (block 1100).

[0091]FIG. 11 illustrates the post cycle process 1100. Because the main purpose of the post cycle process is to restart the arbitration process to process any queued proposals or closure messages, the state of the arbitration object is first checked to determine if it is still idle (block 1101). If another arbitration cycle has been initiated before the post cycle process begins, the post cycle process continues onto the post arbitration process (block 1200) described below.

[0092] If the arbitration object is still in an idle state, the unprocessed proposal queue is examined to determine if there is a current closure message on it (i.e., one from a node for which there is only one queued proposal) (block 1103). If a current closure message is found, the state of the arbitration object is set to waiting for closure (block 1105).

[0093] If there is no current closure message on the list, then the post cycle process determines if there are any proposal messages in the queue (block 1107). If the queue is empty, the post cycle process invokes the post arbitration process (block 1200). Otherwise, the post cycle process gets the next proposal from the queue (block 1109) and determines if it was initiated by the local node (block 1111). A queued proposal from a remote node causes the post cycle process to set the arbitration object's state to waiting for closure to begin the arbitration cycle for the remote proposal as an observer.

[0094] If the proposal was initiated locally, it was added to the unprocessed proposal queue because an arbitration cycle was already in progress when the local node initiated the proposal as described above with reference to FIG. 4. In this case, the unprocessed proposal queue is again examined (block 1113). If there are no remote proposals in the queue, the processor thread that initiated the local proposal is awakened (block 1117). The newly-awakened thread attempts to begin a new arbitration cycle based on the unprocessed proposal, again referring to the process described for FIG. 4.

[0095] If remote proposals remain to be processed, the locally initiated proposal is placed at the end of the unprocessed proposal queue (block 1115) and the post cycle process continues checking the unprocessed proposal queue while the arbitration object is in the idle state.

[0096] The post arbitration process 1200 that causes the arbitrated proposals to be applied on the local node is described in conjunction with FIG. 12. The post arbitration process executes asynchronously to any arbitration cycles and continues executing until there are no proposals on the arbitrated proposal queue. When the post arbitration process is not executing, it is invoked when an arbitrated proposal is placed on the arbitrated proposals queue at the end of an arbitration cycle. In the exemplary embodiment shown in FIG. 12, two proposals can be executing at the same time: an expedited proposal and a non-expedited proposal. The arbitration object maintains a state for the currently executing expedited proposal and for the currently executing non-expedited proposal.

[0097] Assuming initially that there are no executing proposals, the post arbitration process gets the first proposal from the arbitrated proposals queue (block 1209), and determines if it is an expedited or non-expedited proposal (block 121 1). If it is an expedited proposal and no expedited proposal is currently executing (block 1213), the state for the currently executing expedited proposal is set to the expedited proposal (block 1215). If the proposal was initiated locally (block 1217), the corresponding thread was put to sleep to await the outcome of the arbitration as described above in conjunction with FIG. 4, so it is woken up to execute the proposal. If the proposal was from a remote node, the proposal is executed in a special thread.

[0098] In both cases, when the thread completes and returns to the post arbitration process, the state of the currently executing expedited proposal is set to NULL and the next proposal on the arbitrated proposal queue is examined.

[0099] If the queued proposal is a non-expedited proposal, it can be executed if 1) there is no currently executing non-expedited proposal (block 1223), and 2) there is no currently executing expedited proposal (block 1225). In this case, the state of the currently executing non-expedited proposal is set to the non-expedited proposal (block 1227). As with an expedited proposal, the thread for a non-expedited proposal that was initiated locally is woken up to execute the proposal (block 1231) while a special thread executes a non-expedited proposal from a remote node (block 1233). When either thread completes, it returns to the post arbitration process, and the state of the currently executing non-expedited proposal is set to NULL.

[0100] The post arbitration process continues processing the arbitrated proposals queue in this fashion until all the arbitrated proposals are applied. One of skill in the art will readily understand that the operations shown in FIG. 12 for expedited proposals are not necessary for in alternate embodiments in which proposals are not expedited.

[0101] The particular methods performed by computers executing an exemplary embodiment of the arbitration process of the present invention have been described with reference to a state diagram and a series of flowcharts. The states of idle 303, waiting for closure 304, 307, waiting for proposals 305, and waiting for responses 306 have been described in conjunction with the state diagram, and the methods that implement the states of the arbitration object have been illustrated in the flowcharts of FIGS. 4-12, including all the acts from 401 until 415, from 501 until 507, from 601 until 611, 701 until 713, 801 until 825, 901 until 911, 1001 until 1003, 1101 until 1117, and 1201 until 1233.

In Memory Database Implementation

[0102] In this section of the detailed description, a particular implementation of the arbitration process of the present invention is described that is used in a coherent caching version of the In Memory Database (IMDB) system available from Microsoft® Corporation. IMDB is a system used to cache database tables entirely within memory, and to read and write a table from and to a backend database provider computer. The coherently cached version of IMDB allows the same database table to be cached on multiple machines (nodes on a network) and guarantees that the table will appear the same on each machine to transactions that are running on those machines. To be more specific, suppose a table T is shared on three machines M1, M2, and M3. M1 runs transactions X11, X12, and X13 against T. M2 runs transactions X21 and X22 against T, and M3 runs transactions X31, X32, X33, and X34 against T. Assume that no additional transactions are run on any machine. When all machines quiesce, then the contents of table T on all machines will be identical. Now suppose transaction X11 on machine M1 and transaction X21 on machine M2 are running concurrently. Suppose both transactions change record R in table T. There are two possible orderings of the changes to record R: {X11, X21} or {X21, X11}. The arbitration process guarantees that the same ordering of the changes will occur on all machines caching table T.

[0103] The exemplary IMDB implementation of the arbitration process relies on the fact that each instigator node in the domain is aware of the other nodes that coherently cache the object being changed and with which it must communicate to keep data in the object consistent. A variety of techniques can be used to determine which nodes belong to the domain and how nodes are added or dropped as machines are connected or disconnected from the network, as will be easily understood by one skilled in the art. Furthermore, the exemplary IMDB implementation assumes the underlying network protocol adheres the Notification Rule as described in the previous sections, i.e., the network reliably delivers messages sent from one machine to another in order. That is, if M1 sends messages A and then B to M2 then M2 receives message A before it receives message B and that it receives both of them (unless machine A or B happen to be disconnected from the network in the interim). The arbitration process does not make any assumption about the ordering of messages from different machines, i.e., messages between M1 and M3 can be interleaved in any fashion with messages between M1 and M2 in the network—only the delivery of messages from one machine to another are guaranteed to be ordered.

[0104] Because the set of proposals for the current arbitration cycle are the same on all nodes (as explained in the previous sections), the IMDB implementation is able to distribute the responsibility of determining the proper order of the proposals to each node in the domain. In one embodiment, each node is assigned a unique identifier (e.g., a GUID or “globally unique identifier”). If there are multiple proposals in an arbitration cycle, they are ordered by the identifier of the node the proposal came from. The winner is determined to be the instigator node with the lowest GUID.

[0105] Alternate embodiments of the arbitration process are used in conjunction with other IMDB functions. In one alternate embodiment, the arbitration process determines which node will flush changes to the backend database provider for a given transaction when the transaction runs across multiple nodes. Yet another alternate embodiment involves choosing an internal identifier for tables and databases so that they are the same across all machines running the IMDB against a cached set of tables.

[0106] The exemplary IMDB embodiment of the arbitration process implements two basic classes to manage most of the accounting required for arbitration: ArbitrationManager and ArbitrationObject. The ArbitrationManager is a global object on each node that keeps track of all active arbitration objects on the local node and filters messages to the appropriate arbitration object as described further below in conjunction with FIG. 17. The ArbitrationObject keeps track of the state of the arbitration cycle for a given object. Since there can be only one arbitration cycle active for any given entity, there is at most one arbitration object for any entity that is cached on multiple nodes. The ArbitrationObject class is a base class implementation that provides much of the bookkeeping for arbitration cycles. As there can be different implementations of how proposals are processed depending on the type of change proposed, e.g., record changes, choosing database identifiers, etc., various key methods of the base ArbitrationObject class can be overridden by more specialized classes responsible for handling certain kinds of changes. The ArbitrationObject is described below in conjunction with FIG. 16.

[0107] Arbitration Cycle Messages

[0108] As described in the previous section, three kinds of messages used as part of an arbitration cycle. FIGS. 13, 14 and 15 illustrate exemplary embodiments of data structures for the proposal, proposal response, and closure messages, respectively, as used by the IMDB implementation. Each message contains a message type field 1301, 1401, 1501, and an identifier 1302, 1402, 1502 for the object being arbitrated. In the IMDB implementation, the object identifier 1302, 1402, 1502 for a record comprises a lock object type 1311, 1411, 1511, a table identifier 1312, 1412, 1512, an index identifier 1313, 1413, 1513, and a hash value for the primary key of the record 1314, 1414, 1514.

[0109] The proposal message 1300 also contains a change type field 1303 and a transaction identifier 1304 for the associated transaction. In the IMDB implementation, the transaction identifier is a GUID. If the change is to insert a record, a change section 1306 of the proposal message 1300 contains all columns and their associated values. If the change is to modify a record, the full value of the primary key 1305 (shown in phantom) is included because two different primary keys can hash to the same value and the primary key is needed to determine which hash duplicate is associated with the target record. The change section 1306 for a modification contains the column(s) to be modified and the new value(s). If the change is to delete a record, the identifier 1302 and primary key 1305 are sufficient to define the change, so the change section 1306 is not present. In the alternate embodiment described above in which an arbitration cycle is used to determine which node chooses the internal identifiers for shared tables in the database, the change section 1306 contains the database identifier of the table to be allocated an internal identifier.

[0110] The proposal response message 1400 contains only the message type 1401 and the identifier for the entity 1402.

[0111] The closure message 1500 contains the message type 1501 and the identifier for the entity 1502, plus a count 1503 and a list 1504 of all instigator nodes in the arbitration cycle. In the exemplary embodiment, the nodes are identified by their GUID. FIG. 15 also shows, in phantom, ordering information 1504 for the proposals that can be optionally included in the closure message 1500.

[0112] ArbitrationObject

[0113] The ArbitrationObject keeps track of the proposals, responses, and closure messages. It calls out to virtual functions that handle specific arbitration events (discussed in detail further below). As described in the previous sections, it is possible to get a, proposal from a node that does not belong to the current arbitration cycle. For example, a node may send a proposal, then closure, then a proposal from the next arbitration cycle before we have received the remaining proposals from the current arbitration cycle. One of the tasks of the ArbitrationObject is to determine what proposals belong to which arbitration cycles and queue up any proposals for future cycles. Additionally, once a cycle is complete, the ArbitrationObject executes the proposals as discussed above in conjunction with the post cycle and post arbitration processes of FIGS. 11 and 12, respectively. The ArbitrationObject must ensure that the changes in the proposals are applied in the correct order. It therefore maintains an ordered queue of arbitrated proposals that need to be applied, as explained in the previous section.

[0114] An exemplary implementation of an ArbitrationObject is illustrated in FIG. 16. The ArbitrationObject 1600 is identified by the identity of the entity 1601 for which it manages arbitrations and has an ArbitrationState property 1602 that is used to manage the corresponding arbitration cycle. As described above, the ArbitrationState property can be either Idle, WaitingForResponses, WaitingForClosure, or WaitingForProposals. Idle means that there is no current arbitration cycle. Any other state indicates that an arbitration cycle is active. WaitingForResponses indicates that the local node broadcast a proposal to other nodes (i.e., the node is an instigator) and is waiting for responses from the other nodes in the domain. WaitingForClosure means either: (1) the local node is an observer and is waiting for a closure message from the current cycle or (1) the local node is an instigator that has performed the evaluate method and determined that it lost the arbitration, and is therefore waiting for the closure method from the winner of the arbitration. WaitingForProposals means that the local node is an observer that has received the closure message for the current arbitration cycles and is waiting for other proposals for the current arbitration cycle.

[0115] The ArbitrationObject contains a series of lists and queues to manage the messages it sends and receives. The processing of the lists and queues by the ArbitrationObject is as explained in the previous section in conjunction with the similarly named lists and queues.

[0116] NodesSentProposalsTo 1603: If the local node is an instigator, then this is the list of nodes to which it sent proposals.

[0117] NodesReceivedResponsesFrom 1604: If the local node is an instigator, this is the list of nodes from which it received proposal responses.

[0118] NodesExpectingProposalsFrom 1666: If the local node acting as an observer received a closure message, the list of nodes from that message that are instigators in the current arbitration cycle.

[0119] NodesReceivedProposalsFrom 1607: The nodes that sent proposals that belong to the current cycle.

[0120] ProposalsInTheCurrentCycle 1608: Proposals for the current arbitration cycle. (1608)

[0121] ClosureForTheCurrentCycle 1609: Closure message 1610 and node 1611 it came from for the current cycle.

[0122] QueueOfUnprocessedProposals 1612: An ordered queue of proposals that the local node has received but which have not yet been included in any arbitration cycle. This queue can also include unprocessed closure messages as described in the previous section.

[0123] QueueOfArbitratedProposals 1613: An ordered queue of proposals that have been arbitrated and that need to be processed in order at the local node.

[0124] The ArbitrationObject object also maintains a state for the currently executing non-expedited proposal 1614, and for the currently executing expedited proposal 1615. A reference count 1616 in the ArbitrationObject is incremented every time a proposal or closure is added to the ArbitrationObject and is decremented whenever a proposal completes execution or there is no longer a need for the closure message. In addition, other objects in the IMDB can hold on to the ArbitrationObject when necessary. For example, a transaction maintains a list of all arbitrations that involve a record change performed by that transaction until the transaction completes. The transaction uses the list to determine when all proposals related to the transaction (both local and remote) have completed execution. The transaction increments the reference count of the ArbitrationObject when it adds it to the list and decrements it on completion of the transaction. The ArbitrationManager frees up any ArbitrationObject that has a reference count of zero, since that means there are no proposals or closures left to process and also there are no external objects holding onto the arbitration.

[0125] Also as described previously, an ArbitrationObject must handle the arbitration cycle events of arbitrate, evaluate, and terminate. Because different entities in the IMDB require different types of processing, the base class ArbitrationObject does not contain the methods necessary to evaluate the proposals for a specific database object, or other entity, or to properly apply the changes in the proposals. Instead, the base class calls “virtual” functions, and the ArbitrationObject instantiated to manage the arbitrations for the database object provides the methods that implement the virtual functions to appropriately process the events. Exemplary embodiments of the virtual functions in the base class are described next.

[0126] An Evaluate function called if the arbitration cycle was initiated locally (i.e., the local node is an instigator) when all responses have been received from the nodes to which proposals were sent. The Evaluate function is responsible for determining whether the local node wins the arbitration. If so, it must return a closure message. In addition, it adds the proposals in the current arbitration to the QueueOfArbitratedProposals 1613 so that they are processed in the correct order. If Evaluate determines the local node is not the winner, then it returns a value of NULL.

[0127] A Terminate function is called either when the local node is an observer or an instigator that lost the arbitration. In both cases, the local node will have received all messages from all other nodes to the current arbitration cycle and all proposals for the current cycle will be cached in the ArbitrationObject. The Terminate function must order the proposals for the current cycle and add them to the QueueOfArbitratedProposals 1613 so that they are processed in the correct order on the local node.

[0128] A ProcessRequest function is called to process a remotely received proposal during the post arbitration process described in the previous section as a special thread. It changes the object that was the subject of an arbitration in accordance with the contents of the proposal.

[0129] An IsExpeditedProposal function is called by the ArbitrationObject to determine if a proposal is expedited or not. As described in the previous section, the ArbitrationObject adds an expedited proposal to the top of the QueueOfArbitratedProposals 1613 when only non-expedited proposals are on the queue, and after the last expedited proposal on the queue if the queue has existing expedited proposals. The ArbitrationObject also needs to know if a proposal is expedited to know whether the proposal can be executed concurrently with the currently executing non-expedited proposal, as also described previously.

[0130] In an alternate embodiment, the ArbitrationObject also implements an Arbitrate Virtual function. The ArbitrationObject calls the Arbitrate Virtual function for each proposal before it is added to the current cycle. The Arbitrate Virtual function permits the ordering of the proposals in the cycle in an incremental fashion rather than waiting until an Evaluate or Terminate event is triggered.

[0131] ArbitrationManager

[0132] The exemplary implementation of the ArbitrationManager 1700 illustrated in FIG. 17 maintains a hash table of ArbitrationObjects 1702 in which each entry 1701 is hashed on the identity of the entity being arbitrated 1703. For example, in the case of a record, the object's identity is determined by the table identifier and the primary key for the record. The various messages, proposal, proposal response, and closure, all contain the identity of the object as shown in FIGS. 13-15. The ArbitrationManager looks up the corresponding ArbitrationObject in the hash table. If the associated ArbitrationObject is not found, the ArbitrationManager creates it and adds it to the hash table. The ArbitrationManager then calls the appropriate function to handle the incoming message.

[0133] In addition to distributing messages the ArbitrationManager handles the task of starting an arbitration cycle on the local node by providing two functions, Propose and WakeupArbitration. Propose creates a local proposal message and then uses the ArbitrationObject to initiate a proposal as described above with reference to FIG. 4. When Propose returns, the caller can proceed to process the change that was proposed. Upon completion of the change, the caller calls WakeupArbitration, which causes the ArbitrationObject to process the next proposal that is added to the QueueOfArbitratedProposals as described above with reference to FIG. 12.

[0134] In this section, a particular implementation of the arbitration process has been described as implemented in Microsoft's In Memory Database system to propagate changes to a cached table throughout the domain of nodes. An ArbitrationObject is used to track an arbitration cycle for a specific table cached on a node and an ArbitrationManager object is used to manage the ArbitrationObjects for the node. Data structures for proposal, proposal response, and closure messages have been detailed. Various lists and queues used to manage the messages sent and received by the node during the arbitration cycle have been described, along with virtual functions that support the arbitration process.

[0135] Conclusion

[0136] An arbitration process has been described that propagates changes to a shared entity throughout the nodes that share the entity. On any given node, the arbitration cycle starts when either the node attempts to change a shared entity (and therefore sends proposals to the other nodes in the domain as an “instigator”), or when the node receives a proposal from a node (and is therefore an “observer”). In any arbitration cycle, the set of proposals that belong to the cycle is computed to be the same on all nodes and only one node is computed to be the winner.

[0137] The sequence of messages received on an observer node is as follows:

[0138] 1. Receive at least one proposal from one other node;

[0139] 2. Receive any number of proposals from other nodes;

[0140] 3. Receive a closure message from the winner of the arbitration; and

[0141] 4. Receive other proposals from instigators of the arbitration.

[0142] An instigator node that wins an arbitration sends its proposal before it receives any other proposals. Then:

[0143] 1. It may receive any number of proposals and proposal responses from other nodes;

[0144] 2. A proposal belongs to this arbitration cycle if it is received before the proposal response from that node;

[0145] 3. If a proposal response is received before any proposal from a node, then the node is an observer in the cycle;

[0146] 4. If a proposal is received before a proposal response from a node we sent our proposal to, then that node is an instigator; and

[0147] 5. Upon receiving all proposal responses, the winner sends the closure response message and the cycle is complete on the winning node.

[0148] An instigator that loses an arbitration differs from the winner in that:

[0149] 1. It will receive a closure message before or after it receives proposal responses from all other nodes it sent proposals to; and

[0150] 2. The set of instigators, i.e., nodes from which it received a proposal before a proposal response, matches the set of instigators as computed by the winning node, so that it can determine that it did not win the arbitration even before it receives the closure message from the winner.

[0151] Each node receives all proposals from the set of proposals in the cycle prior to the cycle being complete on that node. The arbitration cycle ends when (1) an instigator node that wins the arbitration receives a response from every node that it sent a proposal to, (2) an instigator node that loses the arbitration receives a response from every node that it sent a proposal to and receives a closure notification from the winner, or (3) an observer node receives a closure message from the winner and a proposal from each node mentioned in the closure message. The set of proposals are then applied on each node in the same order.

[0152] Although specific embodiments have been illustrated and described herein, it will be appreciated by those of ordinary skill in the art that any arrangement which is calculated to achieve the same purpose may be substituted for the specific embodiments shown. This application is intended to cover any adaptations or variations of the present invention.

[0153] For example, those of ordinary skill within the art will appreciate that the arbitration process of the present invention can be used to synchronize changes to any resource that is distributed across multiple nodes in a network when such nodes are operating asynchronously. Furthermore, those of ordinary skill within the art will appreciate that appreciate that the arbitration process serves to propagate such changes properly throughout the multiple nodes, even when only one proposal is active in an arbitration cycle.

[0154] Although the invention has been described in part as operating within an object-oriented database environment, the terminology used in this is meant to include any networked environments. Therefore, it is manifestly intended that this invention be limited only by the following claims and equivalents thereof. 

We claim:
 1. A computerized method for arbitrating changes made to a shared entity in a network having multiple nodes with at least one of the nodes acting as an instigator for an arbitration cycle, the method comprising: broadcasting, by each instigator node, a proposal message pertaining to the shared entity; sending, by each node that receives a proposal message, a response to each proposal message to the instigator node that broadcast the proposal message; receiving, by each instigator node, the responses to the proposal message it broadcast; determining, by each instigator node, a winning instigator node; determining, by each node, an order for each proposal message; broadcasting, by the winning instigator node, a closure message containing a list of instigator nodes in the arbitration cycle; and changing, by each node, the shared entity in accordance with the order for each proposal message broadcast by one of the instigator nodes in the arbitration cycle.
 2. The computerized method of claim 1, wherein the elements are performed in the order stated.
 3. The computerized method of claim 1, further comprising: beginning, on each instigator node, the arbitration cycle as a result of broadcasting the proposal message; and terminating, on each instigator node, the arbitration cycle after determining the winning instigator node.
 4. The computerized method of claim 1, wherein each instigator node determines the winning instigator node after receiving all proposal messages in the arbitration cycle.
 5. The computerized method of claim 1, wherein the closure message specifies the order for each proposal message.
 6. The computerized method of claim 1, wherein each node that is not an instigator in the arbitration cycle is an observer and further comprising: beginning, on each observer node, the arbitration cycle as a result of receiving a proposal message; and terminating, on each observer node, the arbitration cycle upon receiving all proposals in the cycle and receiving the closure message from the winning instigator node.
 7. The computerized method of claim 6, wherein each observer node determines the order of the proposal messages after receiving the closure message from the winning instigator node.
 8. The computerized method of claim 1, wherein a proposal message designated as expedited is ordered ahead of any proposal message not designated as expedited.
 9. A computer-readable medium having computer-executable instructions to a cause a computer to perform a method of arbitrating changes to a data object shared among multiple computers, the method comprising: creating an arbitration object associated with the shared data object on a local computer, the arbitration object having a state set to idle; transiting the state of the arbitration object from idle to waiting for closure upon receiving a proposal message to change the data object from a remote computer that shares the data object, such that an observer arbitration cycle is begun on the local computer; transiting the state of the arbitration object from waiting for closure to idle upon receiving a closure message for the observer arbitration cycle when the local computer has received a proposal message from each remote computer listed in the closure message; transiting the state of the arbitration object from waiting for closure to waiting for proposal upon receiving a closure message for the observer arbitration cycle when the local computer is missing a proposal message from at least one remote computer listed in the closure message; transiting the state of the arbitration object from waiting for proposal to idle upon receiving all missing proposal messages for the observer arbitration cycle; transiting the state of the arbitration object from idle to waiting for responses upon broadcasting a proposal message to change the data object to each remote computer that shares the data object, such that an instigator arbitration cycle is begun on the local computer; transiting the state of the arbitration object from waiting for responses to idle upon receiving a response for each proposal message broadcast by the local computer for the instigator arbitration cycle before receiving a closure message for the instigator arbitration cycle from a remote computer; transiting the state of the arbitration object from waiting for responses to idle upon receiving a closure message for the instigator arbitration cycle from a remote computer after receiving a response for each proposal message broadcast by the local computer for the instigator arbitration cycle; and transiting the state of the arbitration object from waiting for closure to idle upon receiving a closure message for the instigator arbitration cycle from a remote computer.
 10. The computer-readable medium of claim 9, further comprising: applying the proposal messages to the data object on the local computer in an order computed in accordance with pre-determined ordering criteria.
 11. The computer-readable medium of claim 10, wherein a proposal message designated as expedited is ordered ahead of any proposal message not designated as expedited.
 12. The computer-readable medium of claim 9, wherein the state of the arbitration object for an instigator arbitration cycle transits from waiting to responses to idle upon determining that the local computer wins the instigator arbitration cycle, and further comprising: transiting the state of the arbitration object from waiting for responses to waiting for closure upon receiving a response for each proposal message broadcast by the local computer for the instigator arbitration cycle before receiving a closure message for the instigator arbitration cycle and upon determining that the local computer loses the instigator arbitration cycle.
 13. The computer-readable medium of claim 12, wherein determining that the local computer wins the instigator arbitration cycle uses pre-determined ranking criteria.
 14. The computer-readable medium of claim 12, wherein the state of waiting for closure for the instigator arbitration cycle comprises: adding a proposal message received by the local computer to an unprocessed proposal queue; determining if a closure message received by the local computer is for the instigator arbitration cycle; logging the closure message for the instigator arbitration cycle; and executing a termination process to transition the state of the arbitration object from waiting for closure to idle as a result of receiving the closure message from the winning node for the instigator arbitration cycle.
 15. The computer-readable medium of claim 9, wherein the state of waiting for closure for the observer arbitration cycle comprises: adding a proposal message received by the local computer to an unprocessed proposal queue; determining if a closure message received by the local computer is for the observer arbitration cycle; logging the closure message for the observer arbitration cycle; and executing a termination process to transition the state of the arbitration object from waiting for closure to idle as a result of receiving the closure message for the observer arbitration cycle when the proposal message expected from each remote computer listed in the closure message for the observer arbitration cycle is in the unprocessed proposal queue.
 16. The computer-readable medium of claim 9, wherein the state of waiting for proposal comprises: adding a closure message received by the local computer to an unprocessed proposal queue; determining if a proposal message received by the local computer is a missing proposal expected from a remote computer in the observer arbitration cycle; adding the expected proposal message to a list of current proposals and a list of received proposals; executing a termination process to transition the state of the arbitration object from waiting for proposals to idle after receiving each missing proposal expected from a remote computer in the observer arbitration cycle.
 17. The computer-readable medium of claim 9, wherein the state of waiting for responses for the instigator arbitration cycle comprises: adding a proposal message received by the local computer to an unprocessed proposal queue when a response from the remote computer is in a list of received responses; adding a proposal message received by the local computer to a list of current proposals and a list of received proposals when a response from the remote computer is not in the list of received responses; determining if a closure message received by the local computer is for the instigator arbitration cycle; logging the closure message for the instigator arbitration cycle; adding a closure message received by the local computer to the unprocessed proposal queue when the closure message is not the closure message for the instigator arbitration cycle; adding a response message received by the local computer to the list of received responses; executing a termination process to transition the state of the arbitration object from waiting for response to idle as a result of receiving the closure message for the instigator arbitration cycle when the response message expected from each remote computer for the instigator arbitration cycle is in the list of received responses; and executing an evaluation process to determine a winner for the instigator arbitration cycle when the response message expected from each remote computer for the instigator arbitration cycle is in the list of received responses and a closure message for the instigator arbitration cycle has not been received.
 18. A computer-readable medium having stored thereon a message data structure comprising: an entity identifier field containing data representing an identifier for an entity; and a message type field containing data representing a type of message associated with the entity identified by the entity identifier field.
 19. The computer-readable medium of claim 18, wherein the entity identifier field comprises: a lock object type field containing data representing a type lock object for the entity; a table identifier field containing data representing a data table for the entity; an index identifier field containing data representing a data index for the entity; and a hashed primary key field containing data representing a hash value for a primary key of the entity.
 20. The computer-readable medium of claim 18, further comprising: a change type field containing data representing a type of change proposed for the entity identified in the entity identifier field; and a transaction identifier field containing data representing a transaction that proposed the change identified by the change type field.
 21. The computer-readable medium of claim 20, further comprising: a change information field containing data representing new information for the entity identified by the entity identifier field.
 22. The computer-readable medium of claim 20, further comprising: a primary key field containing data representing a value for a primary key of the entity identified by the entity identifier field.
 23. The computer-readable medium of claim 18, further comprising: a count field containing data representing a count of nodes that proposed a change to the entity identified by the entity identifier field; and a list field containing data representing an identifier for each of the nodes that proposed a change to the entity identified by the entity identifier field.
 24. The computer-readable medium of claim 23, further comprising: a order field containing data representing an order in which each change proposed by a node identified by the list field should be applied to the entity identified by the entity identifier field.
 25. A computer-readable medium having stored thereon a arbitration object data structure comprising: an identifier field containing data representing an identifier for the arbitration object, wherein arbitrations on an entity associated with the identifier are managed by the arbitration object identified by the identifier field; an arbitration state field containing data representing a state for the arbitration object identified by the identifier field; a currently executing proposal state field containing data representing a state for a currently executing proposal managed by the arbitration object identified by the identifier field; a reference count field containing data representing a count of references to the arbitration object identified by the identifier field; and an arbitration cycle management data structure containing data representing a state of an arbitration managed by the arbitration object identified by the identifier field.
 26. The computer readable medium of claim 25, wherein the arbitration cycle management data structure comprises: a sent proposals field containing data representing a remote node to which the arbitration object identified by the identifier field sent a proposal message; a received responses field containing data representing a remote node from which the arbitration object identified by the identifier field received a response message; an expected proposals field containing data representing a remote node from which the arbitration object identified by the identifier field is expecting a proposal message; a received proposals field containing data representing a remote node from which the arbitration object identified by the identifier field received a proposal message; a current cycle proposals field containing data representing proposal messages for a current arbitration managed by the arbitration object identified by the identifier field received a proposal message; a current closure message field containing data representing a closure message for the current arbitration managed by the arbitration object identified by the identifier field received a proposal message; a current closure node field containing data representing a remote node that sent the closure message identified in the current closure message field; an unprocessed proposals queue containing data representing a proposals waiting to be processed by the arbitration object identified by the identifier field; and an arbitrated proposals queue containing data representing a proposal waiting to be applied to the entity as a result of an arbitration managed by the arbitration object identified by the identifier field.
 27. The computer-readable medium of claim 25, further comprising: a currently executing non-expedited proposal state field containing data representing a state for a currently executing non-expedited proposal managed by the arbitration object identified by the identifier field.
 28. The computer-readable medium of claim 27, further comprising: a currently executing expedited proposal state field containing data representing a state for a currently executing expedited proposal managed by the arbitration object identified by the identifier field.
 29. A computer-readable medium having stored thereon a arbitration manager data structure comprising: an arbitration object field containing data representing an arbitration object managed by the arbitration manager; and an arbitrated entity field containing data representing an identifier for an entity, wherein arbitrations on the entity identified by the arbitrated entity field are managed by the arbitration object identified by the arbitration object field.
 30. A computer system comprising: a processing unit coupled to a network through a system bus; a system memory coupled to the processing unit through a system bus, wherein a data object shared among computers on the network is cached in the system memory; a computer-readable medium coupled to the processing unit through a system bus; and an arbitration process executed from the computer-readable medium by the processing unit, wherein the arbitration process causes the processing unit to create an arbitration object in the system memory for each cached data object such that the arbitration object causes the processing unit to apply ordered changes to the corresponding cached data object as a result of an arbitration among the computers in the network that share the data object.
 31. The computer system of claim 30, wherein the arbitration process further causes the processing unit to create an arbitration manager object in the system memory, wherein the arbitration manager object causes the processing unit to direct messages containing proposals to change a cached data object to the arbitration object for the cached data object.
 32. The computer system of claim 31, wherein the arbitration manager further causes the processing unit to free each arbitration object when all changes to the associated cached data object have been applied.
 33. The computer system of claim 30, wherein the arbitration process caused the processing unit to create each arbitration object with a set of virtual function specific to the corresponding cached data object.
 34. The computer system of claim 33, wherein the set of virtual functions comprises: an evaluate function that determines a winner for an arbitration on the corresponding cached data object; a terminate function that orders the changes to be applied to the corresponding cached data object; and a process request function that executes a change to the corresponding cached data object proposed by a computer in the network.
 35. The computer system of claim 34, wherein the set of virtual functions further comprises: an is expedited proposal function that determines whether a change is designated as expedited.
 36. A computerized method for arbitrating changes made to a shared entity in a network having multiple nodes on a node acting as an instigator for an arbitration cycle, the method comprising: broadcasting a proposal message pertaining to the shared entity; receiving any proposal messages pertaining to the shared entity broadcast by other node in the network; receiving the responses to the proposal message it broadcast; determining a set of proposal messages belonging to the arbitration cycle, wherein the set of proposal messages includes the proposal message broadcast by the instigator node and all proposal messages received by the instigator node before all responses to the proposal message it broadcast have been received; determining a winning instigator node for the arbitration cycle and an order for each proposal message in the arbitration cycle; broadcasting a closure message containing a list of instigator nodes in the arbitration cycle if it is the winning instigator node; and changing the shared entity on the instigator node in accordance with the order for each proposal message in the arbitration cycle.
 37. The computerized method of claim 36, wherein the elements are performed in the order stated.
 38. The computerized method of claim 36, further comprising: beginning the arbitration cycle as a result of broadcasting the proposal message; and terminating the arbitration cycle after determining the winning instigator node.
 39. The computerized method of claim 36, wherein the closure message contains the order for each proposal message in the arbitration cycle.
 40. The computerized method of claim 36, wherein a proposal message designated as expedited is ordered ahead of any proposal message not designated as expedited.
 41. A computerized method for arbitrating changes made to a shared entity in a network having multiple nodes on a node acting as an observer for an arbitration cycle, the method comprising: receiving a proposal message pertaining to the shared entity broadcast by another node in the network; sending a response to the proposal message to the instigator node that broadcast the proposal message; receiving a closure message from the instigator node that won the arbitration cycle; determining a set of proposal messages in the arbitration cycle based on the closure message; determining an order for the set of proposal messages in the arbitration cycle; and changing the shared entity in accordance with the order for each proposal message in the arbitration cycle.
 42. The computerized method of claim 41, wherein the elements are performed in the order stated.
 43. The computerized method of claim 41, wherein the closure message specifies the order for each proposal message.
 44. The computerized method of claim 41, further comprising: beginning the arbitration cycle as a result of receiving a proposal message; and terminating the arbitration cycle upon receiving all proposals in the cycle and receiving the closure message from the winning instigator node.
 45. The computerized method of claim 41, wherein a proposal message designated as expedited is ordered ahead of any proposal message not designated as expedited. 